<?php

require_once dirname(__FILE__) . '/Space.php';
require_once dirname(__FILE__) . '/Space/Go.php';
require_once dirname(__FILE__) . '/Space/GoToJail.php';
require_once dirname(__FILE__) . '/Space/IncomeTax.php';
require_once dirname(__FILE__) . '/Space/LuxuryTax.php';
require_once dirname(__FILE__) . '/Space/Property.php';

class Board_SpaceMaker
{
    private $space_config = array(
        'special'       => array(
            'Go'            => 'Board_Space_Go',
            'Go To Jail'    => 'Board_Space_GoToJail',
            'Income Tax'    => 'Board_Space_IncomeTax',
            'Luxury Tax'    => 'Board_Space_LuxuryTax',
        ),
        'properties'    => array(
            'Mediterranean Avenue'  => array(
                'price' => 60
            ),
            'Baltic Avenue'         => array(
                'price' => 60
            ),
            'Oriental Avenue'
        )
    );

    public function make($name, $board)
    {
        if (in_array($name, array_keys($space_config['special']))) {
            $class_name = $space_config['special'][$name];

            return new $class_name($name, $board);
        }

        if (in_array($name, array_keys($space_config['properties']))) {
            $class_name = $space_config['properties'][$name];

            return new $class_name($name, $board, $price, $rent);
        }

        return new Board_Space($name, $board);
    }
}
